<?php

namespace app\merchant\model;

use think\Model;

/**
 * 商户配置
 */
class MerchantConfig extends Model
{
    //设置当前模型对应的完整数据表名称
    protected $table = 'tp_merchant_config';

    //车资产类型
    const CATEGORY_CAR = 1;
    //消费贷
    const CATEGORY_CONSUME = 2;
    //企业信贷
    const CATEGORY_COMPANY = 3;
    //个人信贷
    const CATEGORY_PERSON = 4;
    
    /**
     * 根据商户id和资产类型获取展业信息
     * @param type $user_id 商户id
     * @param type $category 展业类型
     * @return type array
     */
    public static function getInterestRateTermByCategory($user_id, $category)
    {
        return MerchantConfig::where('user_id', '=', $user_id)->where('is_delete', '=', 0)->where('category', '=', $category)->column('interest_rate', 'term');
    }
}
